package de.wwi11b2.mjp.comicvineclient;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {

	private Button searchButton = null;
	private Button myDatabaseButton = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		searchButton = (Button) findViewById(R.id.searchButton);
		myDatabaseButton = (Button) findViewById(R.id.databaseButton);

		addListener();

	}

	private void addListener() {

		searchButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View view) {
				Intent intent = new Intent();
				intent.setClass(getApplicationContext(), SearchActivity.class);
				startActivity(intent);

			}
		});

		myDatabaseButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View view) {
				Intent intent = new Intent();
				intent.setClass(getApplicationContext(), DatabaseActivity.class);
				startActivity(intent);

			}
		});

		findViewById(R.id.comicVineLinkTextView).setOnClickListener(
				new ComicVineOnClickListener(getApplicationContext()));

	}

}
